
<template>
  <div>
    <el-card
      shadow="hover"
      style="margin-bottom: 10px"
      v-for="(item, index) in listData"
      :key="index"
    >
      <el-row>
        <!-- 仓库详情 -->
        <el-col :span="12">
          <el-row>
            <el-col :span="10">
              <span class="el-icon-s-home dicon"></span>
            </el-col>
            <el-col :span="12">
              <span class="info">仓库名:{{ item.name }}</span>
              <span class="info">负责人:{{ item.admin.name }}</span>
              <span class="info">负责人介绍:{{ item.admin.remarks }}</span>
              <span class="info">电话号码:{{ item.admin.phone }}</span>
              <span class="info">仓库简介:{{ item.remarks }}</span>
              <span class="info">仓库地址:{{ item.address }}</span>
            </el-col>
          </el-row>
        </el-col>

        <!-- 材料图示化 -->
        <el-col :span="12">
          <div class="paybox">
            <span class="info">材料库存:</span>
            <div class="cavasbox">
              <el-tag v-for="(m, i) in item.materials" :key="i">{{
                m.name + " | " + m.count
              }}</el-tag>
            </div>
          </div>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
import dataOrigin from "../../assets/data.json";
import VChart from "vue-echarts";
export default {
  inject: ["reload"],
  data() {
    return {
      types: dataOrigin.materialTypes,
      listData: [],
      condition: {
        currentPage: 1,
        pageSize: 10,
        name: "",
        sex: "",
        status: "",
      },
    };
  },

  /**
   * 创建完毕
   */
  beforeCreate() {},
  created() {
    this.init();
  },
  mounted() {},

  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {
    //初始化仓库
    init() {
      this.$axios
        .get("/warehouse/all")
        .then((d) => {
          if (d.code == 200) {
            this.listData = d.data;
            console.log(this.listData);
          } else {
            this.$message.error(d.message);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
};
</script>

<style scoped>
.el-tag {
  margin: 0 10px 10px 0;
}
.info {
  margin-bottom: 10px;
  display: block;
  font-size: 15px;
  color: darkgray;
}
.dicon {
  font-size: 200px;
}
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
.cavasbox {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
}
.paybox {
  width: 100%;
  background-color: #fff;
  box-sizing: border-box;
  border-radius: 5px;
  height: 200px;
}
.text-c {
  text-align: center;
}
</style>

 
 